var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (i, a) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, i) {
              t.__proto__ = i;
            }) ||
          function (t, i) {
            for (var a in i)
              Object.prototype.hasOwnProperty.call(i, a) && (t[a] = i[a]);
          })(i, a);
      };
      return function (i, a) {
        function n() {
          this.constructor = i;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        t(i, a),
          (i.prototype =
            null === a
              ? Object.create(a)
              : ((n.prototype = a.prototype), new n()));
      };
    })(),
  GuessPapersView = (function (t) {
    function i() {
      var i = t.call(this) || this;
      return (
        i.tab_caiquan_type.on(Laya.Event.CLICK, i, i.onTabCaiQuanTypeAction),
        i.tab_caiquan_result.on(
          Laya.Event.CLICK,
          i,
          i.onTabCaiQuanResultAction
        ),
        (i.tab_caiquan_type.selectHandler = new Laya.Handler(
          i,
          i.onGuessPageTabCoinFn
        )),
        i.btn_caiquan_sure.on(
          Laya.Event.CLICK,
          i,
          i.onCaiQuanyaActionOKBtnDidClick
        ),
        i.btn_caiquan_item0.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i.btn_caiquan_item1.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i.btn_caiquan_item2.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i.btn_caiquan_item3.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i.btn_caiquan_item4.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i.btn_caiquan_item5.on(Laya.Event.CLICK, i, i.onCaiQuanDidClick),
        i
      );
    }
    return (
      __extends(i, t),
      (i.showCaiQuanDialog = function () {
        null == this.caiquanV &&
          ((this.caiquanV = new i()), (this.caiquanV.zOrder = 1e3)),
          this.caiquanV.popup(),
          (this.caiquanV.tab_type = "猜金"),
          (this.caiquanV.tab_caiquan_type.selectedIndex = 0),
          (this.caiquanV.text_caiquan_money.text = ""),
          (this.caiquanV.sumCoin = 0),
          (this.caiquanV.caiquan_type = "0"),
          (this.caiquanV.tab_caiquan_result.selectedIndex = -1),
          this.caiquanV.onGuessPageTabCoinFn(0);
      }),
      (i.prototype.onCaiQuanDidClick = function (t) {
        "猜金" == this.tab_type
          ? ("item0" == t.target.name
              ? (this.sumCoin += 20)
              : "item1" == t.target.name
              ? (this.sumCoin += 100)
              : "item2" == t.target.name
              ? (this.sumCoin += 200)
              : "item3" == t.target.name
              ? (this.sumCoin += 500)
              : "item4" == t.target.name
              ? (this.sumCoin += 800)
              : "item5" == t.target.name && (this.sumCoin += 1e3),
            this.sumCoin >= 1e3
              ? ((this.sumCoin = 1e3),
                (this.text_caiquan_money.text = this.sumCoin + "(最大值)"))
              : (this.text_caiquan_money.text = this.sumCoin + ""))
          : "猜银" == this.tab_type &&
            ("item0" == t.target.name
              ? (this.sumCoin += 1e3)
              : "item1" == t.target.name
              ? (this.sumCoin += 2e3)
              : "item2" == t.target.name
              ? (this.sumCoin += 5e3)
              : "item3" == t.target.name
              ? (this.sumCoin += 1e4)
              : "item4" == t.target.name
              ? (this.sumCoin += 5e4)
              : "item5" == t.target.name && (this.sumCoin += 1e5),
            this.sumCoin >= 1e5
              ? ((this.sumCoin = 1e5),
                (this.text_caiquan_money.text = this.sumCoin + "(最大值)"))
              : (this.text_caiquan_money.text = this.sumCoin + ""));
      }),
      (i.prototype.onGuessPageTabCoinFn = function (t) {
        (this.sumCoin = 0),
          (this.text_caiquan_money.text = this.sumCoin + ""),
          0 == t
            ? ((this.tab_type = "猜金"),
              (this.btn_caiquan_item0.label = "20"),
              (this.btn_caiquan_item1.label = "100"),
              (this.btn_caiquan_item2.label = "200"),
              (this.btn_caiquan_item3.label = "500"),
              (this.btn_caiquan_item4.label = "800"),
              (this.btn_caiquan_item5.label = "1000"))
            : 1 == t &&
              ((this.tab_type = "猜银"),
              (this.btn_caiquan_item0.label = "1000"),
              (this.btn_caiquan_item1.label = "2000"),
              (this.btn_caiquan_item2.label = "5000"),
              (this.btn_caiquan_item3.label = "10000"),
              (this.btn_caiquan_item4.label = "50000"),
              (this.btn_caiquan_item5.label = "100000"));
      }),
      (i.prototype.dealTakeMoney = function (t) {}),
      (i.prototype.onTabCaiQuanTypeAction = function (t) {
        "item0" == t.target.name
          ? this.onGuessPageTabCoinFn(0)
          : "item1" == t.target.name && this.onGuessPageTabCoinFn(1),
          (this.sumCoin = 0),
          (this.text_caiquan_money.text = "");
      }),
      (i.prototype.onTabCaiQuanResultAction = function (t) {
        "item0" == t.target.name
          ? (this.caiquan_type = "1")
          : "item1" == t.target.name
          ? (this.caiquan_type = "2")
          : "item2" == t.target.name && (this.caiquan_type = "3");
      }),
      (i.prototype.onCaiQuanyaActionOKBtnDidClick = function () {
        var t = parseInt(this.text_caiquan_money.text);
        if (t <= 0 || isNaN(t)) ToastView.toastView("请选择金额");
        else if ("0" != this.caiquan_type) {
          var i;
          "猜金" == this.tab_type
            ? (i = 1)
            : "猜银" == this.tab_type && (i = 2),
            WebSocketService.send({
              c: 2110,
              d: { value: this.caiquan_type, type: i, bet: t },
            });
        } else ToastView.toastView("请选择猜拳类型");
      }),
      (i.close = function () {
        this.caiquanV && this.caiquanV.close();
      }),
      i
    );
  })(ui.SquareController.GuessPapersViewUI);
